package com.xms.datacore.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Collection;
import java.util.List;
import java.util.UUID;

/**
 * <p>
 * FinderService
 * </p>
 *
 * @author migo
 * @since 2021/9/2
 */
public class FinderService<T> extends ServiceImpl<BaseMapper<T>, T> implements IFinderService<T>{

    @Override
    public IService<T> getService() {
        return this;
    }

    @Override
    public T getById(UUID id) {
        return super.getById(id);
    }

    @Override
    public List<T> getByIds(Collection<UUID> idList) {
        return super.listByIds(idList);
    }

    @Override
    public T getOne(Wrapper<T> queryWrapper) {
        return super.getOne(queryWrapper);
    }

    @Override
    public int count() {
        return super.count();
    }

    @Override
    public int count(Wrapper<T> queryWrapper) {
        return super.count(queryWrapper);
    }

    @Override
    public List<T> list(Wrapper<T> queryWrapper) {
        return super.list(queryWrapper);
    }

    @Override
    public List<T> list(LambdaQueryWrapper<T> queryWrapper, int limit) {
        return super.list(queryWrapper.last("limit " + limit));
    }

    @Override
    public List<T> all() {
        return super.list();
    }

    @Override
    public <E extends IPage<T>> E page(E page, Wrapper<T> queryWrapper) {
        return super.page(page, queryWrapper);
    }

    @Override
    public <E extends IPage<T>> E page(E page) {
        return super.page(page);
    }
}
